<script>
    //基本语法
    // let [变量1,变量2,..] = [值1,值2,...];

    // ES6允许按照一定的模式
    let [a,b] = [10,20];
    console.log(a,b);


    // 完全解构  
    let [a1,b1,c1] = [100,200,300];
    console.log(a1,b1,c1);


    // 不完全解构
    let [a2,b2] = [1,2,3,4];
    console.log(a2,b2);


    // 解构失败 (解构失败值就是undefined)
    let [a3,b3,c3,d3] = [1,2];
    console.log(a3,b3,c3,d3); //1 2 undefined undefined


    // 省缺值
    let [x,y,,z] = [10,20,30,40];
    console.log(x,y,z);


    // 解构默认值
    let [x1=10,y1=20,z1=30] = ["哈哈",true];
    console.log(x1,y1,z1);

    let [x2,y2=20] = [10,undefined];  //ndefined表示解构失败，就使用默认值
    console.log(x2,y2);


    let w = 10;
    let u = 20;
    [w,u] = [u,w];
    console.log(w,u);

</script>